home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Embed / Sources / EmbedSel.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.3 KB  |  144 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                EmbedSel.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                M.Boetcher
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "Embed.hpp"
  13.  
  14. #ifndef EMBEDSEL_H
  15. #include "EmbedSel.h"
  16. #endif
  17.  
  18. #ifndef EMBEDPART_H
  19. #include "EmbedPar.h"
  20. #endif
  21.  
  22. #ifndef EMBEDPROXY_H
  23. #include "EmbedPxy.h"
  24. #endif
  25.  
  26. // ----- Framework Includes -----
  27.  
  28. #ifndef FWPRESEN_H
  29. #include "FWPresen.h"
  30. #endif
  31.  
  32. //========================================================================================
  33. //    Runtime information
  34. //========================================================================================
  35.  
  36. #ifdef FW_BUILD_MAC
  37. #pragma segment odfembed
  38. #endif
  39.  
  40. //========================================================================================
  41. //    CLASS CEmbedSelection
  42. //========================================================================================
  43.  
  44. //---------------------------------------------------------------------------------------
  45. //    CEmbedSelection constructor
  46. //---------------------------------------------------------------------------------------
  47.  
  48. CEmbedSelection::CEmbedSelection(Environment* ev, CEmbedPart* embeddingPart) :
  49.     FW_CEmbeddingSelection(ev, FALSE, FALSE),
  50.     fEmbeddingPart(embeddingPart),
  51.     fProxy(NULL)
  52. {
  53. }
  54.  
  55. //---------------------------------------------------------------------------------------
  56. //    CEmbedSelection destructor
  57. //---------------------------------------------------------------------------------------
  58.  
  59. CEmbedSelection::~CEmbedSelection()
  60. {
  61. }
  62.  
  63. //---------------------------------------------------------------------------------------
  64. //    CEmbedSelection::CloseSelection
  65. //---------------------------------------------------------------------------------------
  66.  
  67. void CEmbedSelection::CloseSelection(Environment* ev)
  68. {
  69.     // Nothing to do
  70. }
  71.  
  72. //---------------------------------------------------------------------------------------
  73. //    CEmbedSelection::ClearSelection
  74. //---------------------------------------------------------------------------------------
  75.  
  76. FW_Boolean CEmbedSelection::ClearSelection(Environment* ev)
  77. {
  78.     FW_Boolean result = FALSE;
  79.  
  80.     if (fProxy)    // there is an embedded part - don't delete it, because this action might be undone
  81.     {
  82.         fProxy->DetachEmbeddedFrames(ev);
  83.         fEmbeddingPart->SetProxy(ev, NULL);
  84.         GetPresentation(ev)->Invalidate(ev);
  85.         result = TRUE;
  86.     }
  87.  
  88.     return result;
  89. }
  90.  
  91. //---------------------------------------------------------------------------------------
  92. //    CEmbedSelection::SelectAll
  93. //---------------------------------------------------------------------------------------
  94.  
  95. void CEmbedSelection::SelectAll(Environment* ev)
  96. {
  97.     // Nothing to do
  98. }
  99.  
  100. //---------------------------------------------------------------------------------------
  101. //    CEmbedSelection::IsEmpty
  102. //---------------------------------------------------------------------------------------
  103.  
  104. FW_Boolean CEmbedSelection::IsEmpty(Environment* ev) const
  105. {
  106.     return (fProxy == NULL);
  107. }
  108.  
  109. //---------------------------------------------------------------------------------------
  110. //    CEmbedSelection::DoInternalizeSelection
  111. //---------------------------------------------------------------------------------------
  112.  
  113. FW_Boolean CEmbedSelection::DoInternalizeSelection(Environment* ev, 
  114.                                                    ODStorageUnit* sourceSU, 
  115.                                                    FW_CCloneInfo* cloneInfo)
  116. {
  117.     FW_UNUSED(sourceSU);
  118.     FW_UNUSED(cloneInfo);
  119.  
  120.     //     We need to write code here in case we are dragging an embedpart into another 
  121.     //    embedpart. Write now we are going to embed the dragged embedpart
  122.  
  123.     return FALSE;
  124. }
  125.  
  126. //---------------------------------------------------------------------------------------
  127. //    CEmbedSelection::IsSelectionOnlyOneProxy
  128. //---------------------------------------------------------------------------------------
  129.  
  130. FW_MProxy* CEmbedSelection::IsSelectionOnlyOneProxy(Environment* ev) const
  131. {
  132.     return fProxy;
  133. }
  134.  
  135. //----------------------------------------------------------------------------------------
  136. //    CEmbedSelection::SetProxy
  137. //----------------------------------------------------------------------------------------
  138.  
  139. void CEmbedSelection::SetProxy(Environment* ev, CEmbedProxy* proxy)
  140. {
  141.     fProxy = proxy;
  142. }
  143.  
  144.